package behavioral_pattern.visitor_pattern;

/**
 * 财务部类：具体访问者类
 */
public class FADepartment extends Department{
    @Override
    public void visit(FulltimeEmployee fulltimeEmployee) {
        int workTime = fulltimeEmployee.getWorkTime();
        double weeklyWage = fulltimeEmployee.getWeeklyWage();
        if (weeklyWage>40){
            weeklyWage = weeklyWage+(workTime-40)*100;
        }else if (workTime<40){
            weeklyWage = weeklyWage-(40-workTime)*80;
            if (weeklyWage<0){
                weeklyWage = 0;
            }
        }
        System.out.println("正式员工"+fulltimeEmployee.getName()+"实际工资为:"+weeklyWage+"元。");
    }

    @Override
    public void visit(ParttimeEmployee parttimeEmployee) {
        int workTime = parttimeEmployee.getWorkTime();
        double hourWage = parttimeEmployee.getHourWage();
        System.out.println("临时工" + parttimeEmployee.getName() + "实际工资为:" + workTime*hourWage + "元。");
    }
}
